//: [Previous](@previous)

import Foundation

var greeting = "Hello, playground"

//: [Next](@next)

// 区间运算符
for i in 1...5 {
    print(i)
}
print("--------------------------------")

// 半开区间运算符
for i in 7..<12 {
    print(i)
}
print("--------------------------------")

// 单侧区间运算符
var names = ["张三", "李素", "网易", "赵柳"]
for i in names[...2] {
    print(i)
}
print("--------------------------------")

for i in names[..<2] {
    print(i)
}
print("--------------------------------")

let range = ...5
// print(range)
print(range.contains(3))
print(range.contains(7))
print("--------------------------------")

let range2 = "a"..."z"
for char in greeting {
    if !range2.contains(String(char)) {
        print("\(char)不是小写字母")
    }
}
